# 1、下表越界
# IndexError: list index out of range

# age = [1, 2, 33, 44, 11]
# print(age[2])
# print(age[20])

# 2、除0
# ZeroDivisionError: division by zero

# i = 0
# print(100 / i)

# 3、key不存在
#  KeyError: 'sex'
# user = {
#     "name": "张三",
#     "age": 23
# }
#
# print(user["name"])
# print(user["sex"])


# 4、名称异常
# NameError: name 'name' is not defined
# print(name)


# 5、类型异常
# TypeError: unsupported operand type(s) for +: 'int' and 'str'
# print(100 + "2")


# 6、类型转换异常
# ValueError: invalid literal for int() with base 10: '11aaa'
# print(int("11aaa"))


# 7、属性异常
# AttributeError: 'str' object has no attribute 'aa'
# print("python".aa())

# 8、堆栈异常
# RecursionError: maximum recursion depth exceeded while calling a Python object
# def fun():
#     print("fun")
#     fun()
#
# fun()
